<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">

            <h:form id="userForm" enctype="multipart/form-data">
                <br/>
                <h3 class="title">Cadastrar Usuário</h3>
                <p:growl id="messages" showDetail="false" autoUpdate="true"  />

                <p:panel id="userPanel" styleClass="container_24 clearfix withoutBorder">
                    <h4 class="title">Dados Gerais</h4>

                    <p:outputLabel value="Nome" styleClass="grid_3" for="nameInputText"/>
                    <p:inputText id="nameInputText" styleClass="grid_20" value="#{managerCriarUsuario.usuario.nome}" 
                                 required="true" />

                    <p:outputLabel value="Cargo" styleClass="grid_3" for="postInputText"/>
                    <p:inputText id="postInputText" styleClass="grid_20" value="#{managerCriarUsuario.usuario.profissao}" />

                    <p:outputLabel value="E-mail" styleClass="grid_3" for="emailInputText"/>
                    <p:inputText id="emailInputText" styleClass="grid_20" value="#{managerCriarUsuario.usuario.email}" />

                </p:panel>

                <p:panel id="loginPanel" style="background: none; border: none;" 
                         styleClass="container_24 clearfix ">
                    <h4 class="title">Login</h4>

                    <p:outputLabel value="Login" styleClass="grid_3" for="loginInputText"/>
                    <p:inputText id="loginInputText" styleClass="grid_8" 
                                 value="#{managerCriarUsuario.usuario.login}" 
                                 required="true" />
                    <p:outputLabel style="color: #005A27" rendered="#{managerCriarUsuario.mensagemLogin}" styleClass="grid_6" value="login não está disponível !" />

                    <div class="clear"/>

                    <p:outputLabel value="Senha" styleClass="grid_3" for="senhaPassword"/>
                    <p:password id="senhaPassword" styleClass="grid_8" value="#{managerCriarUsuario.usuario.senha}" 
                                required="true" 
                                promptLabel="Digite uma senha segura" weakLabel="Razoável"
                                goodLabel="Boa" strongLabel="Excelente" feedback="true"/>
                    <div class="clear"/>

                    <p:outputLabel value="Repetir Senha" styleClass="grid_4 senhaLabelUsuario" for="confirmPassword"/>
                    <p:password id="confirmPassword" styleClass="grid_8" value="#{managerCriarUsuario.confirm}" 
                                required="true" 
                                promptLabel="Digite uma senha segura" weakLabel="Razoável"
                                goodLabel="Boa" strongLabel="Excelente" feedback="true"/>
                </p:panel>

                <p:panel id="acessoPanel" style="background: none; border: none;" 
                         styleClass="container_24 clearfix ">
                    <h4 class="title">Nível de acesso</h4>
                    <p:pickList id="pickList" value="#{managerCriarUsuario.dualGrupo}" var="g" 
                                converter="grupoconverter" itemLabel="#{g.descricao}" itemValue="#{g}" 
                                showSourceFilter="true" showTargetFilter="true" 
                                filterMatchMode="contains">

                        <f:facet name="sourceCaption">Disponíveis</f:facet>  
                        <f:facet name="targetCaption">Selecionados</f:facet>  
                    </p:pickList>

                </p:panel>
                <br/>
                <div class="buttonAction">
                    <p:commandButton value="Salvar" icon="ui-icon-disk" update="@form"
                                     actionListener="#{managerCriarUsuario.save()}"
                                     styleClass="ui-priority-primary" />
                    <p:button href="pesquisarusuario.xhtml" value="Cancelar"  icon="ui-icon-trash" />
                </div >
            </h:form>
        </ui:define>
    </ui:composition>

</html>
